
function(unittest_binary_link target_test target_src_files)
  set(LOGGER_SRC_DIR ${PROJECT_SOURCE_DIR}/src/common/logger)
  include_directories(${LOGGER_SRC_DIR})
  aux_source_directory(${LOGGER_SRC_DIR} logger_src_files)
  set(target_files ${target_src_files} ${logger_src_files})

  add_executable(${target_test} ${target_files})

  # add_executable(${target_test} ${target_src_files})
  target_link_libraries(${target_test} gtest)
  target_link_libraries(${target_test} z)
  target_link_libraries(${target_test} lz4)
  set_target_properties(${target_test} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${UNITTEST_BIN_DIR})
  set_target_properties(${target_test} PROPERTIES COMPILE_FLAGS "-pthread" LINK_FLAGS "-pthread")
endfunction(unittest_binary_link)

function(add_statis_objtarget target_name target_src_list target_inc_list target_defile_list target_compile_list target_link_list)
  message("add_statis_objtarget(target_name=${target_name}, target_src_list=${${target_src_list}})")
  add_library(${target_name} OBJECT ${${target_src_list}})
  # # redefine_file_macro(${target_name})
  # if (target_inc_list)
  #   target_include_directories(${target_name} PUBLIC ${${target_inc_list}} ${PROJECT_INCLUDE_DIR})
  # endif()
  if (target_defile_list)
    target_compile_definitions(${target_name} PRIVATE ${target_defile_list})
  endif()
  if (target_compile_list)
    target_compile_options(${target_name} PRIVATE ${target_compile_list})
  endif()
  if (target_link_list)
    target_link_options(${target_name} PRIVATE ${target_link_list})
  endif()
endfunction(add_statis_objtarget)
